﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Stats.aspx.vb" Inherits="DusanProject.stats" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<asp:Table ID="tblChart" CssClass="statsTable" runat="server" CellPadding="5" CellSpacing="5" Width="600">

<asp:TableRow>
<asp:TableCell>

<asp:Label ID="lbl1" runat="server" Text="Number of Active and No Active users" CssClass="slideButton"></asp:Label>
</asp:TableCell>
</asp:TableRow>

<asp:TableRow >
    <asp:TableCell VerticalAlign="Middle">

         <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" 
            CellPadding="4" DataSourceID="SqlDataSource1" GridLines="Horizontal">
            <Columns>
                <asp:BoundField DataField="Users" HeaderText="Users" SortExpression="Users" />
                <asp:BoundField DataField="Total" HeaderText="Total" SortExpression="Total" />
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#333333" />
            <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F7F7F7" />
            <SortedAscendingHeaderStyle BackColor="#487575" />
            <SortedDescendingCellStyle BackColor="#E5E5E5" />
            <SortedDescendingHeaderStyle BackColor="#275353" />
        </asp:GridView>

     </asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

<asp:Label ID="lbl2" runat="server" Text="Number of Comments by Users" CssClass="slideButton"></asp:Label>
</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

 <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" 
            CellPadding="4" DataSourceID="SqlDataSource2" GridLines="Horizontal">
            <Columns>
                <asp:BoundField DataField="UserName" HeaderText="UserName" 
                    SortExpression="UserName" />
                <asp:BoundField DataField="Total" HeaderText="Total" 
                    SortExpression="Total" />
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#333333" />
            <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F7F7F7" />
            <SortedAscendingHeaderStyle BackColor="#487575" />
            <SortedDescendingCellStyle BackColor="#E5E5E5" />
            <SortedDescendingHeaderStyle BackColor="#275353" />
        </asp:GridView>

</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

<asp:Label ID="lbl6" runat="server" Text="Number of pictures posted by Users" CssClass="slideButton"></asp:Label>
</asp:TableCell>
</asp:TableRow>


<asp:TableRow>
<asp:TableCell>

<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource6">
    <Series>
        <asp:Series  Name="Series1" XValueMember="UserName" 
            YValueMembers="Total" YValuesPerPoint="4">
        </asp:Series>
    </Series>
    <ChartAreas>
        <asp:ChartArea Name="ChartArea1">
        </asp:ChartArea>
    </ChartAreas>
</asp:Chart>


</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

<asp:Label ID="lbl3" runat="server" Text="Number of Picture Visits" CssClass="slideButton"></asp:Label>
</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>


     <asp:Chart ID="Chart12" runat="server" DataSourceID="SqlDataSource3">
        <Series>
            <asp:Series Name="Series1" XValueMember="TorontoPictureName" 
                YValueMembers="Total">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>


</asp:TableCell>
</asp:TableRow>


<asp:TableRow>
<asp:TableCell>

<asp:Label ID="lbl4" runat="server" Text="Number of Picture Likes" CssClass="slideButton"></asp:Label>
</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

 <asp:Chart ID="Chart13" runat="server" DataSourceID="SqlDataSource4">
        <Series>
            <asp:Series Name="Series1" XValueMember="TorontoPictureName" 
                YValueMembers="Total">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </ChartAreas>
    </asp:Chart>


</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

<asp:Label ID="lbl5" runat="server" Text="Average rating by picture" CssClass="slideButton"></asp:Label>
</asp:TableCell>
</asp:TableRow>

<asp:TableRow>
<asp:TableCell>

 <asp:Chart ID="Chart14" runat="server" DataSourceID="SqlDataSource5">
        <Series>
            <asp:Series ChartType="StackedBar" Name="Series1" 
                XValueMember="TorontoPictureName" YValueMembers="AverageRating">
            </asp:Series>
        </Series>
        <ChartAreas>
            <asp:ChartArea Name="ChartArea1">
            </asp:ChartArea>
        </ChartAreas>
</asp:Chart>


</asp:TableCell>
</asp:TableRow>



</asp:Table>


<br />

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:dbDusanCS %>" 
            ProviderName="<%$ ConnectionStrings:dbDusanCS.ProviderName %>" SelectCommand="SELECT 'Total Users' AS Users
, Count(*) AS Total
FROM Users

UNION

SELECT 'Active Users' AS 'Users'
, Count(*) AS Total
FROM Users
WHERE (((Users.[Active])=True));

UNION SELECT 'Inactive Users' AS 'Users'
, Count(*) AS Total
FROM Users
WHERE (((Users.[Active])=False));"></asp:SqlDataSource>

 <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:dbDusanCS %>" 
            ProviderName="<%$ ConnectionStrings:dbDusanCS.ProviderName %>" SelectCommand="SELECT Users.UserName, [Total] FROM [CommentsStats] 
INNER JOIN [Users] ON [Users].[Id] = [CommentsStats].[FK_User]
ORDER BY [Total]"></asp:SqlDataSource>
    </p>

    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:dbDusanCS %>" 
        ProviderName="<%$ ConnectionStrings:dbDusanCS.ProviderName %>" 
        SelectCommand="SELECT [Total], [TorontoPictureName] FROM [VisitsQuery]">
    </asp:SqlDataSource>

        <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:dbDusanCS %>" 
        ProviderName="<%$ ConnectionStrings:dbDusanCS.ProviderName %>" 
        SelectCommand="SELECT [TorontoPictureName], [Total] FROM [UserLikeChart]">
    </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
    ConnectionString="<%$ ConnectionStrings:dbDusanCS %>" 
    ProviderName="<%$ ConnectionStrings:dbDusanCS.ProviderName %>" 
    SelectCommand="SELECT [TorontoPictureName], [AverageRating] FROM [RatingQuery]">
</asp:SqlDataSource>


<asp:SqlDataSource ID="SqlDataSource6" runat="server" 
    ConnectionString="<%$ ConnectionStrings:dbDusanCS %>" 
    ProviderName="<%$ ConnectionStrings:dbDusanCS.ProviderName %>" 
    SelectCommand="SELECT [UserName], [Total] FROM [PicturesChart]">
</asp:SqlDataSource>




</asp:Content>
